package projet.volleystat.bdd;

import java.util.ArrayList;
import java.util.TreeMap;

import projet.volleystat.DatabaseException;
import projet.volleystat.Player;
import projet.volleystat.Team;
import android.database.Cursor;

/**
 * @author Lameira Nelaupe Ferrand Fiore
 * @version 1.0
 * Creation de la base de donnees : on creera les methodes pour les joueurs, pour les equipes ainsi que pour faire l'association entre un joueur et une equipe.
 */
public interface IRepository {
	/* ---------------- Joueur ---------------- */
	public void commit(Player player) throws DatabaseException;

	public void delete(Player player) throws DatabaseException;

	public ArrayList<Player> getAllPlayerWithoutTeam()
			throws DatabaseException;

	public Player getPlayerById(int id) throws DatabaseException;

	public ArrayList<Player> getAllPlayer() throws DatabaseException;
 
	public Cursor getAllCursorPlayer(String order) throws DatabaseException;

	public Cursor getAllCursorPlayerInTeam(Team e) throws DatabaseException;
	
	public Cursor getAllCursorPlayerNotInTeam(Team e) throws DatabaseException;

	/* ---------------- Equipe ---------------- */
	public void commit(Team team) throws DatabaseException;

	public void delete(Team team) throws DatabaseException;

	public Team getTeamById(int id) throws DatabaseException;

	public ArrayList<Team> getAllTeam() throws DatabaseException;

	public Cursor getAllCursorTeam(String order) throws DatabaseException;

	/* ---------------- Association ---------------- */

	public void associate(Player player, Team team)
			throws DatabaseException;

	public void dissociate(Player player, Team team)
			throws DatabaseException;

	public void dissociation(Player player) throws DatabaseException;

	public void dissociation(Team team) throws DatabaseException;

	public ArrayList<Player> getAllPlayerInTeam(Team e) throws DatabaseException;


	/* ---------------- Statistique ---------------- */
	
	public long commit(int idMatch, int idTeam,int idPlayer,int idAction, int idTargetPlayer, int mark) throws DatabaseException; 
	public void update(int id, int idMatch, int idTeam,int idPlayer,int idAction) throws DatabaseException;
	public void delete(int id)  throws DatabaseException; 
	
	public int getIdGameHigher() throws DatabaseException; 
	public ArrayList < TreeMap<String, Integer> >  getStatPlayer(int idPlayer) throws DatabaseException;
	public ArrayList < TreeMap<String, Integer> >  getStatPlayer(int idPlayer, int idMatch) throws DatabaseException;
	public ArrayList < TreeMap<String, Integer> > getStatMatch(int idMatch) throws DatabaseException;
		
	public void reset() throws DatabaseException;

}
